See my response to this message

complaining about the same thing. You're on the right track but I don't believe it will do to just repeatedly try to save the document. If the copy in memory is out of date you need to load up a new copy that's up to date and make your changes on that. Otherwise the save will either continue to fail all 100 times, or if it succeeds, you're still overwriting someone's changes.